import { postConfirm } from "@/services"
let state =  {
    popupShow: false,
    couponSts: 1,
    couponList: [],
    // 订单入口 0购物车 1立即购买
    orderEntry: "0",
    userAddr: null,
    orderItems: [],
    coupon: {
      totalLength: 0,
      canUseCoupons: [],
      noCanUseCoupons: []
    },
    actualTotal: 0,
    total: 0,
    totalCount: 0,
    transfee: 0,
    reduceAmount: 0,
    remark: "",
    couponIds: [],
    shopCartOrders:[]
  }
let mutations = {
    updateState(state,payload) {
        for(var key in payload){
            state[key] = payload[key]
        }
    }
}
let actions = {
    async postConfirm({commit}, payload) {
        let res = await postConfirm(payload)
        console.log(res)
        commit("updateState", res)
        
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}